package com.study.bigwork.user.service;


import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.study.bigwork.entity.User;
import com.study.bigwork.user.dao.UserDao;

@Service
@Transactional(readOnly=false)
public class UserService {
	@Resource
	private UserDao userDao;
	//service
	//修改用户拍拍币
		public boolean updateClappingMoney(User user) {
			return this.userDao.updateMoney(user);
		}
	//更新用户信息
	public boolean updateUserInfo(User user) {
		this.userDao.updateUserInfo(user);
		return true;
	}
	
	//手机号+密码
	public User findUserByPhoneNumberAndPassword(User user) {
		//调用dao层，查询信息
		User user2 = this.userDao.findUserByPhoneNumberAndPassword(user);
		return user2;
	}
	//判断用户是否存在
	public boolean isExist(User user) {
		return this.userDao.isExist(user);
	}
	//根据手机号查找用户
	public User findUserByPhoneNumber(User user) {
		return this.userDao.findUserByPhoneNumber(user);
	}
	//添加用户
	public boolean addUser(User user) {
		return this.userDao.addUser(user);
	}
	public User findUserById(int id) {
		return this.userDao.findUserById(id);
	}
	public User getUser(String id) {
		return this.getUser(id);
	}
	//获取chat信息
	public User getChatInfo(User user) {
		return this.userDao.getChatInfo(user);
	}
	
	
	

	//通过id获取姓名
	public String findNameById(int id) {
		return userDao.findNameById(id);
	}
	//通过id获取照片
	public String findImageById(int id) {
		return userDao.findImageById(id);
	}
	
}
